package cn.edu.sgu.www.mhxysy.service.trade.impl;

import cn.edu.sgu.www.mhxysy.entity.trade.TradeType;
import cn.edu.sgu.www.mhxysy.mapper.trade.TradeTypeMapper;
import cn.edu.sgu.www.mhxysy.service.trade.TradeTypeService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 沐雨橙风ιε
 * @version 1.0
 */
@Service
public class TradeTypeServiceImpl implements TradeTypeService {

    private final TradeTypeMapper tradeTypeMapper;

    @Autowired
    public TradeTypeServiceImpl(TradeTypeMapper tradeTypeMapper) {
        this.tradeTypeMapper = tradeTypeMapper;
    }

    @Override
    public TradeType selectById(Integer id) {
        return tradeTypeMapper.selectById(id);
    }

    @Override
    public List<TradeType> selectByType(Integer type) {
        QueryWrapper<TradeType> queryWrapper = new QueryWrapper<>();

        queryWrapper.eq("type", type);

        return tradeTypeMapper.selectList(queryWrapper);
    }

}